import QtQuick 2.15
import QtQuick.Controls 2.15
import "../component"

ApplicationWindow {
    id: root

    height: 700
    visible: true
    width: 700

    TextInput {
        id: input1

        KeyNavigation.tab: input2
        // focus: true
        height: 20
        text: "Text Input 1"
        width: 96
        x: 8
        y: 8
    }
    TextInput {
        id: input2

        KeyNavigation.tab: input3
        height: 20
        text: "Text Input 2"
        width: 96
        x: 8
        y: 36
    }
    TextInput1 {
        id: input3

        KeyNavigation.tab: keystt
        height: 20
        input.text: 'TextInput3'
        width: 96
        x: 8
        y: 76
    }
    TextEdit1 {
        id: input4

        KeyNavigation.tab: input1
        height: 104
        input.text: 'textEdit....'
        width: 96
        x: 8
        y: 130
    }
    Rectangle {
        height: 200
        width: 400
        x: 8
        y: 280

        DarkSquare {
            id: keystt
			anchors.fill:parent
            focus: true
            

            Keys.onDownPressed: square.y += 8
            Keys.onLeftPressed: square.x -= 8
            Keys.onPressed: {
                switch (event.key) {
                case Qt.Key_Plus:
                    if (square.scale < 2.0)
                        square.scale += 0.2;
                    break;
                case Qt.Key_Minus:
                    if (square.scale > 0.4)
                        square.scale -= 0.2;
                    break;
                }
            }
            Keys.onRightPressed: square.x += 8
            Keys.onUpPressed: square.y -= 8

            GreenSquare {
                id: square

                x: parent.x + 8
                y: parent.y + 8
            }
        }
    }
}
